package indiwood.model.dao;

import java.util.List;

import indiwood.model.NoticeVO;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class NoticeDAOImpl implements NoticeDAO {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;
	public int write(NoticeVO nvo) {
		return (Integer)sqlSessionTemplate.insert("notice.write", nvo);
	}
	@Override
	public NoticeVO showContent(int no) {
		return sqlSessionTemplate.selectOne("notice.showContent", no);
	}
	@Override
	public List<NoticeVO> noticeList(String pageNo) {
		return sqlSessionTemplate.selectList("notice.noticeList", pageNo);
	}
	@Override
	public void updateCount(int no) {
		sqlSessionTemplate.update("notice.updateCount", no);
	}
	@Override
	public void updateBoard(NoticeVO nvo) {
		sqlSessionTemplate.update("notice.updateBoard", nvo);
	}
	@Override
	public void deleteBoard(String no) {
		sqlSessionTemplate.delete("notice.deleteBoard", no);
	}
	@Override
	public int totalContent() {
		return sqlSessionTemplate.selectOne("notice.totalContent");
	}
}
